# LPCVD standard makefile

# Part 1: Basic components. Don't need to change this section.
LPCVD_DIR=~/LPCVD/code
SRC_DIR = $(LPCVD_DIR)/Blocks
HEADER_DIR = $(LPCVD_DIR)/include
BASIC = $(SRC_DIR)/Signal.cpp $(SRC_DIR)/Sink.cpp $(SRC_DIR)/Source.cpp
BASIC_HEADER = $(HEADER_DIR)/Signal.h $(HEADER_DIR)/Sink.h $(HEADER_DIR)/Source.h

# Part 2: The simulation.
# === START CHANGE FROM HERE ===
PLANT = $(SRC_DIR)/KMC/plant_1DSOS_RDM_input_1Dsin.cpp 
PLANT_HEADER = $(HEADER_DIR)/plant_1DSOS_RDM_input_1Dsin.h
CONTROLLER = $(SRC_DIR)/Controller/Controller.cpp $(SRC_DIR)/Controller/MPC_EW1D_PatternedW_b.cpp $(SRC_DIR)/Controller/MPC_EW1D_PatternedW_equations.cpp
CONTROLLER_HEADER = $(HEADER_DIR)/Controller.h $(HEADER_DIR)/MPC_EW1D_PatternedW_b.h
SIMULATION = ./simulation.cpp ./FittingModel1.cpp

# Part 3: Finish the compilation. Usually don't need to change hereafter
SRC =  $(BASIC) $(SIMULATION) $(PLANT) $(CONTROLLER)
HEADER = $(BASIC_HEADER) $(SIMULATION_HEADER) $(PLANT_HEADER) $(CONTROLLER_HEADER)
INCLUDE_DIR = -I $(LPCVD_DIR)/include/ -I $(LPCVD_DIR)/include/coin
PREDEFINE = -D HAVE_CONFIG_H
DEBUG = -ggdb
PROFILE = -pg
LIB_DIR =  -L ~/lib  -L/u/local/compilers/intel/11.1/069/lib/intel64 -L/u/local/compilers/intel/11.1/069/ipp/em64t/lib -L/u/local/compilers/intel/11.1/069/mkl/lib/em64t -L/u/local/compilers/intel/11.1/069/tbb/intel64/cc4.1.0_libc2.4_kernel2.6.16.21/lib -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2 -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64
LIB_FILE = -lgsl -lgslcblas -lipopt -llapack -lblas -lm -ldl -lgfortranbegin -lgfortran -lm -lgcc_s

simulation.out: $(SRC) $(HEADER)
	g++  $(SRC) $(PREDEFINE) $(INCLUDE_DIR) $(LIB_DIR) $(LIB_FILE) -o3 -o simulation.out
simulation_debug.out: $(SRC) $(HEADER)
	g++  $(SRC) $(PREDEFINE) $(INCLUDE_DIR) $(LIB_DIR) $(LIB_FILE) $(DEBUG) -o simulation_debug.out
simulation_profile.out: $(SRC) $(HEADER)
	g++  $(SRC) $(PREDEFINE) $(INCLUDE_DIR) $(LIB_DIR) $(LIB_FILE) $(DEBUG) $(PROFILE) -o simulation_profile.out
clear:
	rm *.out